import { Base } from "../../../utils/base.js";

class ExamJobs extends Base {
    constructor() {
        super()
    }

    /**
     * 获取职位考核详细
     * @param {*} id 
     * @param {*} success 
     * @param {*} fail 
     */
    getInfo(id, success, fail) {
        this.request({
            url: '/get_exam_jobs/' + id,
            success: (res) => {
                success && success(res.data)
            },
            fail: (res) => {
                fail && fail(res)
            }
        })
    }

    /**
     * 获取科目下的考题
     * @param {*} id 
     * @param {*} success 
     * @param {*} fail 
     */
    getSubjectToQuestion(id, success, fail) {
        this.request({
            url: '/get_exam_question/' + id,
            success: (res) => {
                success && success(res.data)
            },
            fail: (res) => {
                fail && fail(res.data)
            }
        })
    }

    /**
     * 提交考卷
     * @param {*} data 
     * @param {*} success 
     * @param {*} fail 
     */
    setExamQuestion(data,success,fail){
        this.request({
            url:"/set_exam_question",
            data,
            type:"POST",
            success:(res)=>{
                success&&success(res.data)
            },
            fail:(res)=>{
                fail&&fail(res.data)
            }
        })
    }

    /**
     * 获取用户的考试结果
     * @param {*} id 
     * @param {*} success 
     * @param {*} fail 
     */
    getExamResultUser(id,success,fail){
        this.request({
            url:'/get_exam_result_user/'+id,
            success:(res)=>{
                success&&success(res.data)
            },
            fail:(res)=>{
                fail&&fail(res)
            }
        })
    }

    /**
     * 获取用户考核
     * @param {*} success 
     * @param {*} fail 
     */
    getExamQuestionUser(success,fail){
        this.request({
            url:'/get_exam_question_user',
            success:(res)=>{
                success&&success(res.data)
            },
            fail:(res)=>{
                fail&&fail(res.data)
            }
        })
    }


}
export { ExamJobs }